home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
051-075
/
scopedisk69
/
cclat
/
src
/
options.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-19
|
3KB
|
116 lines
/*
* compiler options processing
* March 1989, Miles Bader
*/
#include "common.h"
#include "options.h"
long globalOpts[MAXOPTS/BITSPERLONG];
struct option {
char *name;
int opt;
int *set;
};
/* pre-processor compatibility modes */
int ppOptSet[]={OPT_TRAD, OPT_ANSI, OPT_CPP, 0};
/* cpu-types */
int cpuOptSet[]={OPT_68K, OPT_020, OPT_030, 0};
/* types of floating point support */
int floatOptSet[]={OPT_FFP, OPT_IEEE, OPT_881, 0};
struct option optionlist[]={
/* name mask excludes */
/* parsing */
{"ansi", OPT_ANSI, ppOptSet},
{"c++", OPT_CPP, ppOptSet},
{"traditional", OPT_TRAD, ppOptSet},
/* code gen */
{"abs-code", OPT_ABSCODE},
{"abs-data", OPT_ABSDATA},
{"reg-args", OPT_REGARGS},
{"reload-a4", OPT_RELOADA4},
{"short-ints", OPT_SHORTINTS},
{"long-align", OPT_LONGALIGN},
{"stack-check", OPT_STACKCHECK},
{"pure-strings", OPT_PURESTRINGS},
{"68k", OPT_68K, cpuOptSet},
{"020", OPT_020, cpuOptSet},
{"030", OPT_030, cpuOptSet},
{"881", OPT_881, floatOptSet},
{"ffp", OPT_FFP, floatOptSet},
{"ieee", OPT_IEEE, floatOptSet},
/* linking */
{"detach", OPT_DETACH},
{"resident", OPT_RESIDENT},
{"tiny-main", OPT_TINYMAIN},
{"catch", OPT_CATCH},
{"optimize", OPT_OPTIMIZE},
{"link", OPT_LINK},
{"compile", OPT_COMPILE},
{"assemble", OPT_ASSEMBLE},
{"debug", OPT_DEBUG},
{"echo", OPT_ECHO},
{"filter", OPT_FILTER},
{"exec", OPT_EXEC},
{"big-lc1", OPT_BIGLC1},
NULL
};
void options_SetByName(optname)
char *optname;
{
struct option *opt;
int not=FALSE;
if(strncmp(optname,"no-",3)==0){
optname+=3;
not=TRUE;
}
for(opt=optionlist; opt->name!=NULL; opt++)
if(strcmp(optname,opt->name)==0){
if(not){
if(opt->set!=NULL)
fatal("%s is not a boolean option",opt);
else
options_Clear(opt->opt);
}else{
if(opt->set!=NULL){
int *clear;
for(clear=opt->set; *clear!=0; clear++)
options_Clear(*clear);
}
options_Set(opt->opt);
}
break;
}
if(opt->name==NULL)
fatal("unknown option: %s",optname);
}
void options_Init()
{
int i;
for(i=0; i<(MAXOPTS/BITSPERLONG); i++)
globalOpts[i]=0;
}